package com.damage.supplier.mapper;

import com.damage.common.entity.SupplyGood;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface ISupplyGoodMapper {

    Integer insert(SupplyGood supplyGood);

    SupplyGood findById(Integer id);

    List<SupplyGood> findLikeName(@Param("name") String name,
                                  @Param("supplierId") Integer supplierId);

    List<SupplyGood> findBySupplierId(Integer supplierId);

    List<SupplyGood> findByTypeAndName(@Param("type") Integer type,
                                       @Param("name") String name,
                                       @Param("supplierId") Integer supplierId);

    List<Integer> findRelatePurchasePlanIdById(Integer id);

    List<Integer> findRelateOrderById(Integer id);

    Integer makePurchasePlanObsoleteBatch(@Param("purchasePlanIdList") List<Integer> purchasePlanIdList);

    Integer makeOrderInvalidBatch(@Param("orderIdList") List<Integer> orderIdList);

    Integer updateNextRecordId(@Param("supplyGoodId") Integer supplyGoodId,
                               @Param("nextRecordId") Integer nextRecordId);

    Integer endById(Integer id);
}
